(function (win, doc) {
    var len,
        RENDER_QUEUE_PRE = "__semi_render_data_queue",
        REQUEST_PARAM_QUEUE = "__semi_rpq";
        
    win.__SEMI_SERVERS || (win.__SEMI_SERVERS = {
        "GOME": {
            "url": "http://d189.mzhen.cn/decision",
            "callback": "window.__semi_collect_gome",
            "params": {}
        }
    });

    /* 决策服务回调函数 */
    win.__semi_collect_gome = function(materials){
        win.__semi_materials_collect(materials, "GOME");
    };

    win.__semi_materials_collect = function (materials, server, flag) {
    	if(typeof flag== "undefined"){
    		//console.log('决策返回素材**************');
    	}else{
    		//console.log('决策超时，使用默认素材**************');
    	}
        //console.log(materials);
        var material;
        
        if (materials.constructor == Array) {
        	if(materials.length<1){
        		return;
        	}
        	material = materials[0];
	        materials["server"] = server;
	        materials["pid"] = material.pid;
	        materials["nodeId"] = win.__SEMI_SERVERS[server].params[material.pid].nodeId;
	        materials["style"] = win.__SEMI_SERVERS[server].params[material.pid].style;
	        if (win.__SEMI_SERVERS[server].params[material.pid].click_google){
	            materials["cm"].push(decodeURIComponent(win.__SEMI_SERVERS[server].params[material.pid].click_google));
	        }
	        if (win.__SEMI_SERVERS[server].params[material.pid].click_asci){
	            materials["cm"].push(decodeURIComponent(win.__SEMI_SERVERS[server].params[material.pid].click_asci));
	        }
	        
	        if (!win.__SEMI_SERVERS[server].params[material.pid].renderstate) {
	            win.__SEMI_SERVERS[server].params[material.pid].renderstate = true;
	            if (!flag) {
	                clearTimeout(win.__SEMI_SERVERS[server].params[material.pid].timeout);
	            }
	        } else {
	            if (!win.__SEMI_SERVERS[server].params[material.pid].rendercover) return;
	        }
        }else{
        	material = materials;
            materials["server"] = server;
            materials["pid"] = material.pid;
            materials["nodeId"] = win.__SEMI_SERVERS[server].params[material.pid].nodeId;
            materials["style"] = win.__SEMI_SERVERS[server].params[material.pid].style;
            if (win.__SEMI_SERVERS[server].params[material.pid].click_google){
                materials["cm"].push(decodeURIComponent(win.__SEMI_SERVERS[server].params[material.pid].click_google));
            }
            if (win.__SEMI_SERVERS[server].params[material.pid].click_asci){
                materials["cm"].push(decodeURIComponent(win.__SEMI_SERVERS[server].params[material.pid].click_asci));
            }
            
            if (!win.__SEMI_SERVERS[server].params[material.pid].renderstate) {
                win.__SEMI_SERVERS[server].params[material.pid].renderstate = true;
                if (!flag) {
                    clearTimeout(win.__SEMI_SERVERS[server].params[material.pid].timeout);
                }
            } else {
                if (!win.__SEMI_SERVERS[server].params[material.pid].rendercover) return;
            }
        }
        win[RENDER_QUEUE_PRE].push(materials);
    };
    
    /* 向决策服务器请求物料 */
    function reqToServer(args) {
    	var server = args["_srv"], 
            timeout = args["timeout"],
            server_url = args["_baseurl"],
            materials = {};
        
        //console.log('即将请求素材**************');
        //console.log(args);
        if (server){
            if (server_url) {
                createScript(server_url + getUrlParams(args));
            } else {
                createScript(win.__SEMI_SERVERS[server]["url"] + getUrlParams(args));
            }
			
			/* 超时投放默认素材 */
	        if (args['src'] && args['ldp'] && args['w'] && args['h'] ){
	            materials = {
	                'pid': args['l'],
	                'src': args['src'],
	                'adw': args['w'],
	                'adh': args['h'],
	                'pm': {},
	                'cm': [],
	                'ldp':  args['ldp']
	            };
	            if (!timeout) timeout = 5000;
                win.__SEMI_SERVERS[server].params[materials.pid].timeout = setTimeout(function() {timeoutController(materials, server)}, timeout);
	        }
        }
    }

    function getUrlParams(args) {
    	var result = "",
            l,
            arg,
            page = "",
            referrer = "",
            server;
        if (args && (l = args.l)) {
            server = args["_srv"];
            if (l.constructor == Array) {
                var nodeIds = args["_id"];
                for(var i=0,len=l.length;i<len;i++){
                    var n = l[i];
                    var params = {};
                    params["pid"] = n;
                    params["w"] = args['w'][i];
                    params["h"] = args['h'][i];
                    params["max"] = args['max'][i];
                    params["showtype"] = args['showtype'][i];
                    params["time"] = args['time'][i];
                    params["arraytype"] = args['arraytype'][i];
                    params["code"] = args['code'][i];
                    params["nodeId"] = (nodeIds ? nodeIds[i] : server + "_" + n);
                    params["renderstate"] = false;
                    if (!args["_rc"]){
                    	params["rendercover"] = false;
                    }else{
                    	 params["rendercover"] = true;
                    }
                    if (args["_callback"]) params["callback"] = args["_callback"];
                    
                    if (args["_style"]) params["style"] = args["_style"];  

                    if (args["_click_google"] && (args["_click_google"].indexOf("http") != -1)) params["click_google"] = args["_click_google"]
                       
                    if (args["_click_asci"] && (args["_click_asci"].indexOf("http") != -1)) params["click_asci"] = args["_click_asci"]

                    win.__SEMI_SERVERS[server].params[n] = params;
                }
            } else {
                var params = {};
                params["pid"] = l;
                params["w"] = args['w'];
                params["h"] = args['h'];
                params["max"] = args['max'];
                params["showtype"] = args['showtype'];
                params["time"] = args['time'];
                params["arraytype"] = args['arraytype'];
                params["code"] = args['code'];
                params["nodeId"] = (args["_id"] ? args["_id"] : server + "_" + l);
                params["renderstate"] = false;
                if (!args["_rc"]) params["rendercover"] = false;
                else params["rendercover"] = true;
                if (args["_callback"]) params["callback"] = args["_callback"]; 
                
                if (args["_style"]) params["style"] = args["_style"];                      

                if (args["_click_google"] && (args["_click_google"].indexOf("http") != -1)) params["click_google"] = args["_click_google"]

                if (args["_click_asci"] && (args["_click_asci"].indexOf("http") != -1)) params["click_asci"] = args["_click_asci"]

                win.__SEMI_SERVERS[server].params[l] = params;
            }
            try {
                if (args["u"]) page = args["u"];
                else page = encodeURIComponent(win.top.document.location.href);
				if (args["f"]) referrer = args["f"];
                else referrer = encodeURIComponent(win.top.document.referrer);
            } catch (e) {
                page = encodeURIComponent(doc.referrer);
            }

	        delete args["_srv"];
	        delete args["_id"];
	        delete args["u"];
	        delete args["f"];
            delete args["_timeout"];
            delete args["_rc"];
            delete args["_baseurl"];
            delete args["_callback"];
            delete args["_material"];
            delete args["_style"];
            delete args["_click_google"];
            delete args["_click_asci"];

            //for (arg in args) {
            //    result += "&" + arg + "=" + encodeURIComponent(args[arg]);
            //}
            //result += "&c=" + win.__SEMI_SERVERS[server]["callback"] + "&v=2";
            //if(!args["r"]){
            //    result += "&r=1";
            //}
            //

            //result += "&f=" + referrer + "&u=" + page + "&mv=j" + version;
            //
            //add by shewei for gome adserving
            result += "&p=" + l;
            result += "&c=" + win.__SEMI_SERVERS[server]["callback"]
            
            if (args["k1"]) result += "&k1=" + args["k1"];
            if (args["k2"]) result += "&k2=" + args["k2"];
            if (args["k3"]) result += "&k3=" + args["k3"];
            
            if (args["user"]) result += "&u=" + args["user"];
            if (args["ip"]) result += "&ip=" + args["ip"];
        }
        //console.log(result);
        return "?" + result.substr(1);
    }
    
    function timeoutController(materials, server) {
        var len, constructor = materials.constructor;
        if (constructor == Array) {
            for (var i = 0, len = materials.length; i < len; i++) {
                if (!win.__SEMI_SERVERS[server].params[materials[i].pid].renderstate) {
                    win.__semi_materials_collect(materials[i], server, false); 
                }                
            }
        } else {
            if (!win.__SEMI_SERVERS[server].params[materials.pid].renderstate) {
                win.__semi_materials_collect(materials, server, false); 
            }  
        }
    }

	function createScript(src) {
        var js = doc.createElement("script"),
            fs = doc.getElementsByTagName('script')[0];
        js.charset = "utf-8";
        js.type = "text/javascript";
        js.async = true;
        js.src = src;
        js.rel = "noreferrer";
        fs.parentNode.insertBefore(js, fs);
    }

    function SEMIQueue() {
        this.push = function (param) {
            param.constructor == Object && reqToServer(param);
        };
    }
     
    !win[RENDER_QUEUE_PRE] && (win[RENDER_QUEUE_PRE] = []);
    !win[REQUEST_PARAM_QUEUE] && (win[REQUEST_PARAM_QUEUE] = []);
    if(win[REQUEST_PARAM_QUEUE].constructor == Array) {
        len = win[REQUEST_PARAM_QUEUE].length;
        while (len--) {
            reqToServer(win[REQUEST_PARAM_QUEUE].shift());
        }
        win[REQUEST_PARAM_QUEUE] = new SEMIQueue();
    }

})(window, document);



/********* semi_ad_render *********/
var semiadx = (function (semiadx, win, doc) {

    var isLoaded = false,
        onloadFunc = win.onload,
        materialMap = {},
        RENDER_QUEUE_PRE = "__semi_render_data_queue",
        SEMI_RSQ = "__semi_ad_rsq",
        PLAYER_URL = "semiad_rp.swf";
    /*******detect if flash is supported *******/
    var hasFlash = false;

    try {
      var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
      if(fo) {
        hasFlash = true;
      }
    } catch (e) {
      if(navigator.mimeTypes
            && navigator.mimeTypes['application/x-shockwave-flash'] != undefined
            && navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin) {
        hasFlash = true;
      }
    }

    semiadx.render = function (materials) {
        var i = 0,
            constructor,
            len;
        if (!materials) return;
        constructor = materials.constructor;
        dealTask(materials);
        /*if (constructor == Array) {
            for (len = materials.length; i < len;) {
                semiadx.render(materials[i++]);
            }
        } else if (constructor == Object) {
            dealTask(materials);
        }*/
    };

    win.onload = function () {
        isLoaded = true;
        win.onload = onloadFunc;
        onloadFunc && onloadFunc.call(win);
    };

    win.__get_params = function(pid){
        return materialMap[pid];
    };
    
    /* 检测服务器 */
    function sendToMonitor(arr, type, server) {
        var i = 0,
            img,
            len;
        for (len = arr.length; i < len;) {
            img = new Image();
            img.onload = img.onerror = function() {};
            img.src = prepareURL(arr[i++]);
        }
    }

    function prepareURL(str) {
        if(str.indexOf(".miaozhen.com") < 0) return str;
        if(str.indexOf('?') < 0) str += '?';
        var ch = str.slice(-1);
        if(!(ch == '?' || ch == '&')) {
            str += '&';
        }
        str += 'mv=j' + version;
        return str;
    }

    function renderMaterial(material, node) {
    	//console.log('即将渲染素材**************');
    	//console.log(material)
    	var server = material.server,
    		pid = material.pid, 
    		w = win.__SEMI_SERVERS[server].params[pid].w,
    		h = win.__SEMI_SERVERS[server].params[pid].h,
    		ps = "", 
    		pm = '', 
    		adArr = [],
    		midArr = [];
    		
    	if(material.constructor == Array){
    		for (var i = 0, len = material.length; i < len; i++) {
	    		var _material = material[i],
	    			adw = _material.adw,
			        adh = _material.adh,
			        src = _material.src,
			        ldp = _material.ldp,
			        type = _material.type,
			        ldpFunc,
			        clkFunc,
			        maskDiv,
			        needClkEvent = false,
			        flashId = server + '_' + pid + '_OBJ_' + i,
			        maskId = server + '_' + pid + '_MASK_' + i,
			       // eventMask = '<div id="' + maskId + '" style="position:absolute;width:' + w + 'px;height:' + h + 'px;cursor:pointer;background-color:rgb(255,255,255);opacity:0;filter:alpha(opacity=0);"></div>',
			        flashCode = getFlashCode(src, ps, adw, adh, flashId, false);
			        
			    switch (type) {
				    case "I":
				        //adArr.push(eventMask + '<img height="' + h + '" width="' + w + '" border="0" src="' + src + '" style="width:' + w + 'px;height:' + h + 'px;line-height:' + h + 'px" />');
				        adArr.push('<a href="' + ldp +'" style="width:' + adw + 'px;height:' + adh + 'px;overflow:hidden;display:inline-block;*display:inline;*zoom:1;" target="_blank"><img height="' + adh + '" width="' + adw + '" border="0" src="' + src + '" style="width:' + adw + 'px;height:' + adh + 'px;line-height:' + adh + 'px" /></a>');
				        break;
				    case "F":
				        if(!hasFlash && src_backup != undefined){
				        	//adArr.push(eventMask + '<img height="' + h + '" width="' + w + '" border="0" src="' + src_backup + '" style="width:' + w + 'px;height:' + h + 'px;line-height:' + h + 'px" />');
				        	adArr.push('<a href="' + ldp +'" style="width:' + adw + 'px;height:' + adh + 'px;overflow:hidden;display:inline-block;*display:inline;*zoom:1;" target="_blank"><img height="' + adh + '" width="' + adw + '" border="0" src="' + src_backup + '" style="width:' + adw + 'px;height:' + adh + 'px;line-height:' + adh + 'px" /></a>');
				            type = 'I';
				        }
				        else    
				        	adArr.push('<a href="' + ldp +'" style="width:' + adw + 'px;height:' + adh + 'px;overflow:hidden;display:inline-block;*display:inline;*zoom:1;" target="_blank">' + flashCode + '</a>');
						break;
				    default:
				        break;
			    }
			    
			    if(pm == '' && _material.pm[0])pm = _material.pm[0][0]
			    if(_material.pm[0] && _material.pm[0][0]!=''){
			    	_material.pm[0][0].replace(/[\?&]([_\w]+)=([^&]+)/g, function (all, key, val) {
			    		if(key=='m')midArr.push(val);
		            });
			    }
			    
			    /*if (imp.constructor == Object) {
	                var s0imp = imp["0"];
	                if (s0imp && s0imp.constructor == Array) {
	                    sendToMonitor(s0imp, "imp", server);
	                    delete imp["0"];
	                }
	                for (var sec in imp) {
	                    var sximp = imp[sec];
	                    if (sximp.constructor == Array) {
	                        (function (sximp, sec) {
	                            win.setTimeout(function () {
	                                sendToMonitor(sximp, "imp", server);
	                            }, parseInt(sec) * 1000);
	                        })(sximp, sec);
	                    }
	                }
	            }*/
			    
	            /*maskDiv = doc.getElementById(maskId);
	            if (ldp) {
	                ldpFunc = function () {
	                    win.open(ldp, "_blank");
	                };
	                needClkEvent = true;
	            }*/
	            /*if (clk.constructor == Array) {
	                clkFunc = function () {
	                    sendToMonitor(clk, "clk", server);
	                };
	                needClkEvent = true;
	            }*/
	            /*if (needClkEvent) {
	                maskDiv && (maskDiv.onclick = function () {
	                    clkFunc && clkFunc();
	                    ldpFunc && ldpFunc();
	                });
	            }*/
	    	}
    	}else{
    		var _material = material,
    			adw = _material.adw,
		        adh = _material.adh,
		        src = _material.src,
		        ldp = _material.ldp,
		        type,
		        ldpFunc,
		        clkFunc,
		        maskDiv,
		        needClkEvent = false,
		        flashId = server + '_' + pid + '_OBJ_' + i,
		        maskId = server + '_' + pid + '_MASK_' + i,
		       // eventMask = '<div id="' + maskId + '" style="position:absolute;width:' + w + 'px;height:' + h + 'px;cursor:pointer;background-color:rgb(255,255,255);opacity:0;filter:alpha(opacity=0);"></div>',
		        flashCode = getFlashCode(src, ps, w, h, flashId, false);
		        
		        if(!type){
		        	if (src.lastIndexOf(".swf") + 4 == src.length) {
	                    type = 'F';
	                } else {
	                    type = 'I';
	                }
		        }
		        
		    switch (type) {
			    case "I":
			        //adArr.push(eventMask + '<img height="' + h + '" width="' + w + '" border="0" src="' + src + '" style="width:' + w + 'px;height:' + h + 'px;line-height:' + h + 'px" />');
			        adArr.push('<a href="' + ldp +'" target="_blank"><img height="' + adh + '" width="' + adw + '" border="0" src="' + src + '" style="width:' + adw + 'px;height:' + adh + 'px;line-height:' + adh + 'px" /></a>');
			        break;
			    case "F":
			        if(!hasFlash && src_backup != undefined){
			        	//adArr.push(eventMask + '<img height="' + h + '" width="' + w + '" border="0" src="' + src_backup + '" style="width:' + w + 'px;height:' + h + 'px;line-height:' + h + 'px" />');
			        	adArr.push('<a href="' + ldp +'" target="_blank"><img height="' + adh + '" width="' + adw + '" border="0" src="' + src_backup + '" style="width:' + adw + 'px;height:' + adh + 'px;line-height:' + adh + 'px" /></a>');
			            type = 'I';
			        }
			        else    
			        	adArr.push('<a href="' + ldp +'" target="_blank">' + flashCode + '</a>');
					break;
			    default:
			        break;
		    }
		    
		    if(pm == '' && _material.pm[0])pm = _material.pm[0][0]
		    if(_material.pm[0] && _material.pm[0][0]!=''){
		    	_material.pm[0][0].replace(/[\?&]([_\w]+)=([^&]+)/g, function (all, key, val) {
		    		if(key=='m')midArr.push(val);
	            });
		    }
		    
    	}
    	
    	if(pm != ''){
    		var _mid = pm.substring(pm.indexOf('&m='),pm.indexOf('&u='));
    		pm = pm.replace(_mid, '&m='+midArr.join('_'));
    		sendToMonitor([pm], "imp", server);
    	}
    	
        node.style.width = w + 'px';
        node.style.height = h + 'px';
        node.style.overflow = 'hidden';
        //node.innerHTML = adArr;
        initAd(adArr, material, node);
    }
    
    function initAd (adArr, material, node){
    	var server = material.server,
    		pid = material.pid, 
    		_m = win.__SEMI_SERVERS[server].params[pid],
    		w = _m.w,
    		h = _m.h,
			max = _m.max, 
			showtype = _m.showtype, 
			time = _m.time, 
			arraytype = _m.arraytype,
			customtmpl = decodeURIComponent(_m.code),
    		timer,
			key = decodeURIComponent('material'),
			current = 0,
			slideId = pid+'_slider';
			
		if(!adArr[0]){
			adArr[0] = '请刷新重试';
		}
		for(var i=0; i<max; i++){
			if(!adArr[i])adArr.push(adArr[0]);
		}
    	
		var init = function(){
			if(showtype == 1){
				var _tmpl = '', 
					_page = '', 
					_slideTmpl = ['<div id="'+slideId+'" style="width:'+w+'px;height:'+h+'px;overflow:hidden;position:relative;"><ul style="width:'+w+'px;height:'+h+'px;overflow:hidden;position:relative;padding:0;margin:0;">{{ lis }}</ul><div style="position:absolute; bottom:10px; right:10px; z-index:2;">{{ pages }}</div></div>'].join('');
				
				for(var i=0; i<max; i++){
					_tmpl += ('<li style="background:#fafafa;position:absolute;z-index:1;">'+adArr[i]+'</li>');
					_page += ('<a style="width:22px; height:22px; background:#999; border-radius:100%; color:#fff; text-align:center; font-size:10px; line-height:22px; margin:0 1px; cursor:default; display:inline-block; *display:inline; *zoom:1;">'+(i+1)+'</a>');
				}
				
				_tmpl = _slideTmpl.replace('{{ lis }}', _tmpl).replace('{{ pages }}', _page);
				//$('body').append(_tmpl);
				node.innerHTML = _tmpl
				
				/*if($('#'+slideId+' ul').width()<(24*max) && $('#'+slideId+' ul').height()>(24*max)){
					$('#'+slideId+' .page').css({'width':'22px'});
					$('#'+slideId+' .page a').css({'margin':'1px 0'});
				}
				$('#'+slideId+' a').on({
					mouseenter: function(){
						var index = $(this).index();
						clearInterval(timer);
						slideTo(index);
					},
					mouseleave: initTimer
				});*/
				var s = document.getElementById(slideId);
				del_ff(s);    //清理空格
				for(var i=0; i<s.childNodes[1].childNodes.length; i++){
					s.childNodes[1].childNodes[i].onmouseover = function(){
						clearInterval(timer);
						slideTo(parseInt(this.innerHTML)-1);
					}
					s.childNodes[1].childNodes[i].onmouseout = initTimer
				}
				initTimer();
				slideTo(0);
				current = 1;
			}else if(showtype == 2){
				//$('body').append(adArr[i].join(''));
				node.innerHTML = adArr.join('')
			}else if(showtype == 3){
				//$('body').append(customtmpl);
				node.innerHTML = customtmpl;
				var imgs = [],
					imgArr = node.getElementsByTagName('img');
				for(var i=0; i<imgArr.length; i++){
					if(imgArr[i].getAttribute(key)){
						imgs.push(imgArr[i]);
					}
				}
				var _material = material;
				if(material.constructor != Array){
					_material = [material]
				}
				for(var i=0; i<max; i++){
					if(!_material[i])_material.push(_material[0]);
				}
				for(var i=0; i<imgs.length; i++){
					imgs[i].src = _material[i].src;
					imgs[i].style.cursor = 'pointer';
					imgs[i].ldp = _material[i].ldp;
					imgs[i].onclick = function (e) {
						win.open(this.ldp, "_blank");
	                };
				}
				
				//模板中js的执行
				 var scripts = node.getElementsByTagName('script'); 
				 for(var i=0; i<scripts.length; i++){
					 var js = doc.createElement("script"); 
					 js.charset = "utf-8";
					 js.async = true;
					 if(scripts[i].src){
						 js.src = scripts[i].src;
					 }else{
						 js.textContent = scripts[i].textContent;
					 }
					 node.removeChild(scripts[i]);
					 document.body.appendChild(js);
				}
			}else{
				//$('body').append('<img data-src="holder.js/'+w+'x'+h+'/'+colorArr[0]+':#fff" alt="广告位预览">');
				node.innerHTML = adArr.join('');
			}
		}
		var del_ff = function(elem){
			if(!elem)return;
    		var elem_child = elem.childNodes;
    		for(var i=0; i<elem_child.length;i++){
	    		if(elem_child[i].nodeName == "#text" && !/\s/.test(elem_child.nodeValue)){
	    			elem.removeChild(elem_child)
	    		}
    		}
		}
		var slideTo = function(index){
			var s = document.getElementById(slideId);
			if(!s)return;
			del_ff(s);    //清理空格
			
			for(var i=0; i<s.childNodes[0].childNodes.length; i++){
				s.childNodes[0].childNodes[i].style.zIndex = -1;
			}
			s.childNodes[0].childNodes[index].style.zIndex = 1;
			
			for(var i=0; i<s.childNodes[1].childNodes.length; i++){
				s.childNodes[1].childNodes[i].style.background = '#999'; 
			}
			s.childNodes[1].childNodes[index].style.background  = '#E4393C';
		}
		var initTimer = function(){
			timer = setInterval(function(){
				slideTo(current);
				current<max-1?current++:current=0;
			}, time);
		}
		setTimeout(init,10);
    }

    function dealTask(material) {
        var node = doc.getElementById(material.nodeId);
        if(node) {
            renderMaterial(material, node);
        }else if(!isLoaded) {
            win.setTimeout(function () {
                dealTask.call(null, material);
            }, 50);
        }
    }
    
    function pushDataToRenderStyleQueue(data) {
        win[SEMI_RSQ] || (win[SEMI_RSQ] = []);
        win[SEMI_RSQ].push(data);
    }

    function RenderQueue() {
        this.push = function (materials) {
            semiadx.render(materials);
        };
    }

    function getFlashCode(src, ps, w, h, flashId, rm) {
        var p = '', q = '';
        if(rm) {
            p = '<param name="allowFullScreen" value="true" />';
            q = 'allowfullscreen="true"';
        } else {
            p = '<param name="wmode" value="transparent" />';
            q = 'wmode="transparent"';
        }
        return '<object id="' + flashId + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ' + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" ' + 'align="middle" width="' + w + '" height="' + h + '"> ' + p + ' <param name="allowScriptAccess" value="always" />' + '<param name="movie" value="' + src + '"/>' + '<param name="quality" value="high"/>' + '<param name="bgcolor" value="#000"/>' + '<param name="width" value="' + w + '" />' + '<param name="height" value="' + h + '" />' + (ps ? '<param name="FlashVars" value="' + ps + '" />' : '') + '<embed src="' + src + '" quality="high" ' + 'bgcolor="#000" width="' + w + '" height="' + h + '" ' + 'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" ' + 'allowscriptaccess="always" loop="true" ' + q + ' name="' + flashId + '" ' + (ps ? 'flashvars="' + ps + '" ' : '') + '></embed></object>';
    }

    var queueN = win[RENDER_QUEUE_PRE];
    if(queueN && queueN.constructor == Array) {
        semiadx.render(queueN);
        win[RENDER_QUEUE_PRE] = new RenderQueue();
    }

})(semiadx || {}, window, document);
